/*
 *
 */

jsx3.Class.defineClass(
        "tibco.admin.enterpriseAssets.shdResDefs.JDBC.ShdJdbcResDefs", //the full name of the class to create
        jsx3.lang.Object, //  extends class
        [tibco.admin.enterpriseAssets.shdResDefs.ShdResDefsInterface], // implements interface
        function (plugin) {

            plugin.prototype.details = null;
            // TODO: handle multiple instances?

            // Implementation of the ShdResDefsInterface
            plugin.instance = null

            plugin.prototype.initPlugin = function() {
                tibco.admin.Main.loadResource("tibco/admin/enterpriseAssets/shdResDefs/JDBC/jss/jss.xml", "tibco.admin", "ljss_25C", "ljss", false);
                tibco.admin.Main.loadResource("tibco/admin/enterpriseAssets/shdResDefs/JDBC/jss/value.xml", "tibco.admin", "jss_25C", "jss", false);
            }

            plugin.prototype.destroyPlugin = function() {
            }

            plugin.getInstance = function(args) {
                if(!this.instance) {
                    this.instance = new tibco.admin.enterpriseAssets.shdResDefs.JDBC.ShdJdbcResDefs();
                }
                return this.instance;
            }

            plugin.prototype.loadComponent = function(parent, master, id, name, description) {
                var me = this;
                this.details = new tibco.admin.enterpriseAssets.shdResDefs.JDBC.ShdJdbcResDefDetails(master, parent, id,
                        name, description, me);
                this.details.loadView();
                return this.details;
            }

            plugin.prototype.getType = function() {
                return "JDBC";
            }

            plugin.prototype.getAddText = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@AddText_JDBC");
            }

            plugin.prototype.getImagePath = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@addin@JDBC Icon Path");
            }

            plugin.prototype.addSharedResourceDefinition = function(parent, master) {
                var me = this;
                this.details = new tibco.admin.enterpriseAssets.shdResDefs.JDBC.ShdJdbcResDefDetails(master, parent,
                        null, null, null, me);
                this.details.loadAdd();
                return this.details;
            }
            // End implementation of the ShdResDefsInterface

        });

jsx3.Class.defineClass(
        "tibco.admin.enterpriseAssets.shdResDefs.JDBC.ShdJdbcResDefDetails", //the full name of the class
        tibco.admin.enterpriseAssets.shdResDefs.ShdResDefDetails, //  extends ShdResDefDetails
        null, // implements no interface
        function (details) {
            details.ONTYPESELECTED = "tibco.admin.enterpriseAssets.shdResDefs.JDBC.TYPESELECTED";
            details.ONPICKJNDI = "tibco.admin.enterpriseAssets.shdResDefs.JDBC.PICKJNDI";
            details.ONTESTCONNECTION = "tibco.admin.enterpriseAssets.shdResDefs.JDBC.TESTCONNECTION";
            details.ONDRIVERSELECTED = "tibco.admin.enterpriseAssets.shdResDefs.JDBC.DRIVERSELECTED";
            details.ONXASELECTED = "tibco.admin.enterpriseAssets.shdResDefs.JDBC.ONXASELECTED";

            details.prototype.subType = null;
            details.prototype.helpID = "EnterpriseAssets.SharedResourceDefinitions.SharedResourceDefinitions.JDBC";

            details.prototype.init = function(master, parent, id, name, description, handler) {
                this.jsxsuper(master, parent, id, name, description, handler);
                this.editableComponentList.addAll(["selSubtype_25C", "cmbDriver_25C", "txtURL_25C",
                        "txtUserName_25C", "txtPassword_25C", "txtMaxCnx_25C", "txtLoginTimeout_25C", "btnJndiConfigName_25C",
                        "txtDataSrcName_25C"], this.editableComponentList.size());
                this.rwComponentList.addAll(["selSubtype_25C", "cmbDriver_25C", "txtURL_25C",
                        "txtUserName_25C", "txtPassword_25C", "txtMaxCnx_25C", "txtLoginTimeout_25C",
                        "btnJndiConfigName_25C", "txtDataSrcName_25C", "btnTestConnection_25C"], this.editableComponentList.size());
                this.roComponentList.addAll(["lblcSubtype_25C", "lblcDriver_25C", "lblcURL_25C",
                        "lblcUserName_25C", "lblcPassword_25C", "lblcMaxCnx_25C", "lblcLoginTimeout_25C",
                        "lblcJndiConfigName_25C", "lblcDataSrcName_25C"], this.editableComponentList.size());
            }

            details.prototype.getType = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@SRDType_JDBC");
            }

            details.prototype.getHelpId = function() {
                return this.helpID;
            }

            details.prototype.getDetailsOperation = function() {
                return "getJdbcResourceDetails";
            }
            details.prototype.getDetailsOperationRules = function() {
                return "tibco/admin/enterpriseAssets/shdResDefs/JDBC/rules/getJdbcResourceDetails.xml";
            }
            details.prototype.editOperation = function() {
                return "editJdbcResource";
            }
            details.prototype.editOperationRules = function() {
                return "tibco/admin/enterpriseAssets/shdResDefs/JDBC/rules/editJdbcResource.xml";
            }
            details.prototype.addOperation = function() {
                return "addJdbcResource";
            }
            details.prototype.addOperationRules = function() {
                return "tibco/admin/enterpriseAssets/shdResDefs/JDBC/rules/addJdbcResource.xml";
            }
            details.prototype.getDetailsComponent = function() {
                return "tibco/admin/enterpriseAssets/shdResDefs/JDBC/components/shdJdbcResDefDetails.xml";
            }
            details.prototype.getSecondaryDetailsComponent = function() {
                return null;
            }

            // TODO: make name unique
            details.prototype.getDefaultName = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@defaultName_JDBC");
            }
            details.prototype.getDefaultDescription = function() {
                return tibco.admin.Main.getServer().getDynamicProperty("@defaultDescription_JDBC");
            }

            details.prototype.initializeGenericDetails = function(objEvent) {
                this.jsxsuper(objEvent);
                if(objEvent.status == "SUCCESS") {
                    this.addTestConnectionButton(false);
                }
            }

            details.prototype.initializeSpecificDetails = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.initSubtype();
                    this.initDriverCombox();
                    this.mainComponent.getDescendantOfName("selSubtype_25C").subscribe(details.ONTYPESELECTED,
                            this, this.showSubDetails);
                    this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").subscribe(details.ONPICKJNDI,
                            this, this.pickJNDI);
                }
                this.jsxsuper(objEvent);

                objEvent.obj.handler = this;
            }

            details.prototype.initializeGenericAdd = function(objEvent) {
                this.jsxsuper(objEvent);
                if(objEvent.status == "SUCCESS") {
                    this.addTestConnectionButton(true);
                }
            }

            details.prototype.initializeSpecificAdd = function(objEvent) {
                if(objEvent.status == "SUCCESS") {
                    this.initSubtype();
                    this.initDriverCombox();
                    this.mainComponent.getDescendantOfName("selSubtype_25C").setValue("JDBC");
                    this.mainComponent.getDescendantOfName("selSubtype_25C").subscribe(details.ONTYPESELECTED,
                            this, this.showSubDetails);
                    this.showSubDetails();
                    this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").subscribe(details.ONPICKJNDI,
                            this, this.pickJNDI);
                }
                this.jsxsuper(objEvent);

                objEvent.obj.handler = this;
                this.showSubDetails();
            }

            details.prototype.initSubtype = function() {
                var str = '<data jsxid="jsxroot">';
                str += '<record jsxid="JDBC" jsxtext="' + tibco.admin.Main.getServer().getDynamicProperty("@@subtypeJDBC_25C") + '" />';
                str += '<record jsxid="JNDI" jsxtext="' + tibco.admin.Main.getServer().getDynamicProperty("@@subtypeJNDI_25C") + '" />';
                str += '</data>';
                var sel = this.mainComponent.getDescendantOfName("selSubtype_25C");
                tibco.admin.Main.getServer().getCache().clearById(sel.getXMLId());
                sel.setXMLString(str);
                sel.repaint();
            }

            details.prototype.initDriverCombox = function() {
                var str = '<data jsxid="jsxroot">';
                str += '<record jsxid="tibcosoftwareinc.jdbc.oracle.OracleDriver" jsxtext="' + tibco.admin.Main.getServer().getDynamicProperty("@@tibcosoftwareinc.jdbc.oracle.OracleDriver_25C") + '" />';
                str += '<record jsxid="org.hsqldb.jdbcDriver" jsxtext="' + tibco.admin.Main.getServer().getDynamicProperty("@@org.hsqldb.jdbcDriver_25C") + '" />';
                str += '<record jsxid="tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver" jsxtext="' + tibco.admin.Main.getServer().getDynamicProperty("@@tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver_25C") + '" />';
                str += '</data>';
                var sel = this.mainComponent.getDescendantOfName("cmbDriver_25C");
                tibco.admin.Main.getServer().getCache().clearById(sel.getXMLId());
                sel.setXMLString(str);
                sel.setValue("org.hsqldb.jdbcDriver");
                sel.repaint();
                this.selectDriver();
                sel.subscribe(details.ONDRIVERSELECTED, this, this.selectDriver);
            }

            details.prototype.addTestConnectionButton = function(enabled) {
                var button = new com.gix.gui.Button("btnTestConnection_25C", "", "", 
					tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Width"), tibco.admin.Main.getServer().getDynamicProperty("@btnTestConnection_25C"));
                button.setHeight(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Height"));
                button.setFontName(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Font Name"));
                button.setFontSize(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Font Size"));
                button.setFontWeight(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Font Weight"));
                button.setColor(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Color"));
                button.setDisabledColor(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Disabled Color"));
                button.setBackgroundColor(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn BGColor"));
                button.setPadding(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Padding"));
                button.setMargin(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Margin"));
                button.setBorder(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Border"));
                button.setDisabledBackgroundColor(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Disabled BGColor"));
                button.setClassName(tibco.admin.Main.getServer().getDynamicProperty("@addin@Btn Css Rule Name"));
                button.setDisplay(jsx3.gui.Block.DISPLAYNONE);
                button.subscribe(details.ONTESTCONNECTION, this, this.testConnection);
                button.setEvent('this.publish({subject:"' + details.ONTESTCONNECTION + '"});',
                        jsx3.gui.Interactive.EXECUTE);
                var pane = this.mainComponent.getDescendantOfName("paneEditActions_25");
                pane.setChild(button, jsx3.app.Model.PERSISTNONE);
                pane.adoptChild(pane.getChild("paneHelp_25"), true, false);
            }

            details.prototype.testConnection = function(event) {
                var objService = tibco.admin.Main.loadService("tibco.admin",
                        "tibco/admin/enterpriseAssets/shdResDefs/JDBC/rules/testJdbcResource.xml",
                        "testJdbcResource", "Test JDBC Shared Resource");
                objService.setEndpointURL(tibco.admin.util.ServiceHelper.getSharedResourcesEndpointURL());

                objService.name = this.mainComponent.getDescendantOfName("txtName_25").getValue();
                objService.description = this.mainComponent.getDescendantOfName("txtDescription_25").getValue();
                this.setRequestDetails(objService);

                //subscribe and call
                objService.subscribe(jsx3.net.Service.ON_SUCCESS, this, this.onCallTestConnectionSuccess);
                objService.doCall();
            }

            details.prototype.ongetConfigDetailsSuccess = function(objEvent) {
                var response = tibco.admin.Main.getServer().Cache.getDocument("xmlCacheIDGetJdbcDetailsResponse_25C").getRecordNode("jsxroot");
                this.jsxsuper(response);

                var value = response.getAttribute("subtype");
                this.mainComponent.getDescendantOfName("selSubtype_25C").setValue(value, true);

                var obj = tibco.admin.Main.getServer().getJSXByName("blkDetailsForType_25C");
                this.mainComponent.getDescendantOfName("blkJndiConfigName_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                this.mainComponent.getDescendantOfName("blkDataSrcName_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                this.mainComponent.getDescendantOfName("blkURL_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                this.mainComponent.getDescendantOfName("blkUserName_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                this.mainComponent.getDescendantOfName("blkPassword_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                this.mainComponent.getDescendantOfName("blkMaxCnx_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                this.mainComponent.getDescendantOfName("blkDriver_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                this.mainComponent.getDescendantOfName("blkLoginTimeout_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                switch(value) {
                    case "JDBC":
                        this.mainComponent.getDescendantOfName("lblcSubtype_25C").setText(tibco.admin.Main.getServer().getDynamicProperty("@@subtypeJDBC_25C"), true);
                        value = response.getAttribute("url");
                        this.mainComponent.getDescendantOfName("lblcURL_25C").setText(value, true);
                        this.mainComponent.getDescendantOfName("txtURL_25C").setValue(value, true);
                        value = response.getAttribute("username");
                        this.mainComponent.getDescendantOfName("lblcUserName_25C").setText(value, true);
                        this.mainComponent.getDescendantOfName("txtUserName_25C").setValue(value, true);
                        value = response.getAttribute("password");
                    // TODO: set password field length based on real password length?
                        this.mainComponent.getDescendantOfName("txtPassword_25C").setValue(value, true);
                        value = response.getAttribute("driver");
                        this.mainComponent.getDescendantOfName("lblcDriver_25C").setText(value, true);
                        this.mainComponent.getDescendantOfName("cmbDriver_25C").setValue(value, true);
                        value = response.getAttribute("loginTimeout");
                        this.mainComponent.getDescendantOfName("lblcLoginTimeout_25C").setText(value, true);
                        this.mainComponent.getDescendantOfName("txtLoginTimeout_25C").setValue(value, true);
                        value = response.getAttribute("maxConnections");
                        this.mainComponent.getDescendantOfName("lblcMaxCnx_25C").setText(value, true);
                        this.mainComponent.getDescendantOfName("txtMaxCnx_25C").setValue(value, true);
                        break;
                    case "JNDI":
                        this.mainComponent.getDescendantOfName("lblcSubtype_25C").setText(tibco.admin.Main.getServer().getDynamicProperty("@@subtypeJNDI_25C"), true);
                        value = response.getAttribute("JndiSharedConfigName");
                        this.mainComponent.getDescendantOfName("lblcJndiConfigName_25C").setText(value, true);
                        this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").setDynamicProperty("jsxtext", null);
                        this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").setText(value, true);
                    // TODO: set callback on button to display picker dialog
                        value = response.getAttribute("dataSourceName");
                        this.mainComponent.getDescendantOfName("lblcDataSrcName_25C").setText(value, true);
                        this.mainComponent.getDescendantOfName("txtDataSrcName_25C").setValue(value, true);
                        break;
                }
                var me = this;
                setTimeout(function() {
                    me.setEditable(true);
                    me.showSubDetails();
                },0);
            }

            details.prototype.selectDriver = function(event) {
                var txt = this.mainComponent.getDescendantOfName("txtURL_25C");
                switch(this.mainComponent.getDescendantOfName("cmbDriver_25C").getValue()) {
                    case tibco.admin.Main.getServer().getDynamicProperty("@@tibcosoftwareinc.jdbc.oracle.OracleDriver_25C"):
                        txt.setValue(tibco.admin.Main.getServer().getDynamicProperty("@@oracleserverurl_25C"), true);
                        break;
                    case tibco.admin.Main.getServer().getDynamicProperty("@@org.hsqldb.jdbcDriver_25C"):
                        txt.setValue(tibco.admin.Main.getServer().getDynamicProperty("@@hsqlserverurl_25C"), true);
                        break;
                    case tibco.admin.Main.getServer().getDynamicProperty("@@tibcosoftwareinc.jdbc.sqlserver.SQLServerDriver_25C"):
                        txt.setValue(tibco.admin.Main.getServer().getDynamicProperty("@@sqlserverurl_25C"), true);
                        break;
                    default : break;
                }
            }

            details.prototype.showSubDetails = function(event) {
                try {
                var obj = tibco.admin.Main.getServer().getJSXByName("blkDetailsForType_25C");
                switch(this.mainComponent.getDescendantOfName("selSubtype_25C").getValue()) {
                    case "JDBC":
                        this.mainComponent.getDescendantOfName("blkJndiConfigName_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkDataSrcName_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkDriver_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.mainComponent.getDescendantOfName("blkURL_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.mainComponent.getDescendantOfName("blkUserName_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.mainComponent.getDescendantOfName("blkPassword_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.mainComponent.getDescendantOfName("blkMaxCnx_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.mainComponent.getDescendantOfName("blkLoginTimeout_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.fixRow(this.mainComponent.getDescendantOfName("blkDriver_25C"));
                        this.fixRow(this.mainComponent.getDescendantOfName("blkURL_25C"));
                        this.fixRow(this.mainComponent.getDescendantOfName("blkUserName_25C"));
                        this.fixRow(this.mainComponent.getDescendantOfName("blkPassword_25C"));
                        this.fixRow(this.mainComponent.getDescendantOfName("blkMaxCnx_25C"));
                        this.fixRow(this.mainComponent.getDescendantOfName("blkLoginTimeout_25C"));
                        obj.adoptChild(obj.getChild("blkJndiConfigName_25C"), true);
                        obj.adoptChild(obj.getChild("blkDataSrcName_25C"), true);
                        this.initializeJDBCParamJDBC();//070818

                        break;
                    case "JNDI":
                        this.mainComponent.getDescendantOfName("blkURL_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkUserName_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkPassword_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkMaxCnx_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkDriver_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkLoginTimeout_25C").setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
                        this.mainComponent.getDescendantOfName("blkJndiConfigName_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.mainComponent.getDescendantOfName("blkDataSrcName_25C").setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
                        this.fixRow(this.mainComponent.getDescendantOfName("blkJndiConfigName_25C"));
                        this.fixRow(this.mainComponent.getDescendantOfName("blkDataSrcName_25C"));
                        obj.adoptChild(obj.getChild("blkDriver_25C"), true);
                        obj.adoptChild(obj.getChild("blkURL_25C"), true);
                        obj.adoptChild(obj.getChild("blkUserName_25C"), true);
                        obj.adoptChild(obj.getChild("blkPassword_25C"), true);
                        obj.adoptChild(obj.getChild("blkMaxCnx_25C"), true);
                        obj.adoptChild(obj.getChild("blkLoginTimeout_25C"), true);
                        this.initializeJDBCParamJNDI();//070818
                        break;
            }
            } catch(ex) {
                    alert(ex);
                    tibco.admin.Main.logException(ex);
            }
        }

            details.prototype.fixRow = function(obj) {
                jsx3.log("Object: " + obj);
                var count = obj.getChildren().length;
                for(var i = 0; i < count; i++) {
                    obj.adoptChild(obj.getChild(0), true);
                }
            }

            details.prototype.pickJNDI = function(event) {
                var pick = this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").getText();
                if(pick == "Choose JNDI configuration") {
                    pick = null;
                }
                tibco.admin.enterpriseAssets.shdResDefs.ShdResDefPicker.pickChoice(event.source, "JNDI", pick);
            }

            details.prototype.setEditRequestDetails = function(objService) {
                this.setRequestDetails(objService);
            }

            details.prototype.setAddRequestDetails = function(objService) {
                this.setRequestDetails(objService);
            }

            details.prototype.setRequestDetails = function(objService) {
                objService.subtype = this.mainComponent.getDescendantOfName("selSubtype_25C").getValue();
                switch(objService.subtype) {
                    case "JDBC":
                        objService.url = this.mainComponent.getDescendantOfName("txtURL_25C").getValue();
                        objService.username = this.mainComponent.getDescendantOfName("txtUserName_25C").getValue();
                        objService.password = this.mainComponent.getDescendantOfName("txtPassword_25C").getValue();
                        objService.driver = this.mainComponent.getDescendantOfName("cmbDriver_25C").getValue();
                        objService.loginTimeout = this.mainComponent.getDescendantOfName("txtLoginTimeout_25C").getValue();
                        objService.maxConnections = this.mainComponent.getDescendantOfName("txtMaxCnx_25C").getValue();
                        break;
                    case "JNDI":
                        objService.JndiSharedConfigName = this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").getText();
                        objService.dataSourceName = this.mainComponent.getDescendantOfName("txtDataSrcName_25C").getValue();
                        break;
                }
            }

            details.prototype.onCallTestConnectionSuccess = function(objEvent) {
                var response = tibco.admin.Main.getServer().Cache.getDocument("xmlCacheIDTestConnectionResponse_25C").getRecordNode("jsxroot");

                if(response.getAttribute("wasSuccessful") == 'true') {
                    tibco.admin.Main.alert(tibco.admin.Main.getServer().getDynamicProperty("@@TestConSuccess_25C"), tibco.admin.Main.getServer().getDynamicProperty("@@TestConSuccessMSG_25C"));
                }
                else {
                    tibco.admin.Main.alert(tibco.admin.Main.getServer().getDynamicProperty("@@TestConFailed_25C"), response.getAttribute("summary"));
                }
            }


            /*070818
               * if user doesn't fishish all the required fields, the "save" button will be disabled.  part 2 for jdbc
               */
            details.prototype.valiJDBCDriver = function(obj) {
                this.passedItems["driver"] = tibco.admin.util.Validation.doValidateNotEmptyNoWhSpace(obj, null, tibco.admin.Main.getServer().getDynamicProperty("@@Driver_25C"));
                this.enableSaveBtn4Add();
            }

            details.prototype.valiJDBCDB = function(obj, strValue) {
                this.passedItems["DBURL"] = tibco.admin.util.Validation.doValidateNotEmptyNoWhSpace(obj, strValue, tibco.admin.Main.getServer().getDynamicProperty("@@URL_25C"));
                this.enableSaveBtn4Add();
            }

            details.prototype.valiJDBCUser = function(obj, strValue) {
                this.passedItems["DBName"] = tibco.admin.util.Validation.doValidateNotEmptyNoWhSpace(obj, strValue, tibco.admin.Main.getServer().getDynamicProperty("@@UserName_25C"));
                this.enableSaveBtn4Add();
            }

            details.prototype.valiJDBCDSName = function(obj, strValue) {
                this.passedItems["JDBCDSName"] = tibco.admin.util.Validation.doValidateNotEmptyNoWhSpace(obj, strValue, tibco.admin.Main.getServer().getDynamicProperty("@@DataSrcName_25C"));
                this.enableSaveBtn4Add();
            }

            details.prototype.valiJDBCJNDIName = function(obj) {
                this.passedItems["JDBCJNDIName"] = this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").getText() && this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").getText() != "Choose JNDI configuration";
                this.enableSaveBtn4Add();
            }

            details.prototype.initializeJDBCParamJDBC = function() {
                this.passedItems = {};
                this.passedItems["namePassed"] = tibco.admin.util.Validation.trimAll(this.mainComponent.getDescendantOfName("txtName_25").getValue())?true:false;
                this.passedItems["driver"] = tibco.admin.util.Validation.trimAll(this.mainComponent.getDescendantOfName("cmbDriver_25C").getValue())?true:false;
                this.passedItems["DBURL"] = tibco.admin.util.Validation.trimAll(this.mainComponent.getDescendantOfName("txtURL_25C").getValue())?true:false;
                //this.passedItems["DBName"] = tibco.admin.util.Validation.trimAll(this.mainComponent.getDescendantOfName("txtUserName_25C").getValue())?true:false;
                this.enableSaveBtn4Add();
            }
            details.prototype.initializeJDBCParamJNDI = function() {
                this.passedItems = {};
                this.passedItems["namePassed"] = tibco.admin.util.Validation.trimAll(this.mainComponent.getDescendantOfName("txtName_25").getValue())?true:false;
                this.passedItems["JDBCDSName"] = tibco.admin.util.Validation.trimAll(this.mainComponent.getDescendantOfName("txtDataSrcName_25C").getValue())?true:false;
                this.passedItems["JDBCJNDIName"] = this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").getText() && this.mainComponent.getDescendantOfName("btnJndiConfigName_25C").getText() != "Choose JNDI configuration";
                this.enableSaveBtn4Add();
            }

        });
